using FireStarterModeller.BO;
using Habanero.BO;

namespace Firestarter.DB.Schema.Logic
{
    public class DBDataTypeMappingAccess : IDBDataTypeMapping
    {
        public BusinessObjectCollection<TypeMapping> GetDefaultTypeMappings()
        {
            // Indicates how the DB-specific data type on the left matches to
            //  the generic data type on the right
            string[,] mappings = {
                                     //FromType, ToType
                                     {"BINARY", DBDataTypes.BINARY},
                                     {"BIT", DBDataTypes.BIT},
                                     {"DATETIME", DBDataTypes.DATETIME},
                                     {"DECIMAL", DBDataTypes.DECIMAL},
                                     {"MONEY", DBDataTypes.DECIMAL},
                                     {"IMAGE", DBDataTypes.TEXT},
                                     {"CHARACTER", DBDataTypes.CHAR},
                                     {"INTEGER", DBDataTypes.INTEGER},
                                     {"TINYINT", DBDataTypes.TINYINT},
                                     {"SMALLINT", DBDataTypes.SMALLINT},
                                     {"UNIQUEIDENTIFIER", DBDataTypes.UNIQUEIDENTIFIER},
                                     {"REAL", DBDataTypes.DECIMAL},
                                     {"FLOAT", DBDataTypes.DECIMAL},
                                     {"TEXT", DBDataTypes.TEXT}

                                 };
            BusinessObjectCollection<TypeMapping> standardTypeMappings = new BusinessObjectCollection<TypeMapping>();
            for (int pairNum = 0; pairNum < mappings.Length / 2; pairNum++)
            {
                standardTypeMappings.Add(new TypeMapping { FromType = mappings[pairNum, 0], ToType = mappings[pairNum, 1] });
            }
            return standardTypeMappings;
        }
    }
}